<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="control">
<xsl:apply-templates select="title"/>
<br/>
	<xsl:apply-templates select="input"/>
	<xsl:apply-templates select="select"/>
	<xsl:apply-templates select="textarea"/>
</xsl:template>

<xsl:template match="form//control/title">
	<!--<font xsl:use-attribute-sets="form">
		<xsl:attribute name="color">-->
			<xsl:choose>
			    <xsl:when test="count(../@invalid)">
				<b><font xsl:use-attribute-sets="form_error"><xsl:value-of select="text()" disable-output-escaping="yes" /></font>&#160;<sup><font color="{$form_error}">*</font></sup></b>
				</xsl:when>
				<xsl:when test="../@required">
					<b><font xsl:use-attribute-sets="form_required"><xsl:value-of select="text()" disable-output-escaping="yes" /></font>&#160;<sup><font color="{$form_error}">*</font></sup></b>
				</xsl:when>
				<xsl:otherwise>
					<font xsl:use-attribute-sets="form"><xsl:value-of select="text()" disable-output-escaping="yes" /></font>
				</xsl:otherwise>
			</xsl:choose>
		<!--</xsl:attribute>
	<xsl:value-of select="text()"/></font>-->
</xsl:template>

<!-- Avdiev -->
<xsl:template match="form/control/input">
	<xsl:copy-of select="."/>
</xsl:template>


<!-- Avdiev
<xsl:template match="form/control/input[@type!='hidden']">
	<input><xsl:copy-of select="@*"/></input>
</xsl:template>

<xsl:template match="form//input[@type!='radio' and @type!='checkbox' and @type!='submit']">
	<input><xsl:copy-of select="@*"/></input>
</xsl:template>
-->

<xsl:template match="form/control[input[@type='radio' or @type='checkbox']]">
	<xsl:for-each select="input">
	<input><xsl:copy-of select="@*"/></input><xsl:value-of select="text()"  disable-output-escaping="yes" /><br/>
	</xsl:for-each>
</xsl:template>

<xsl:template match="form//textarea">
	<textarea><xsl:copy-of select="@*"/><xsl:value-of select="text()" disable-output-escaping="yes" /></textarea>
</xsl:template>

<xsl:template match="form//select">
<select><xsl:copy-of select="@*"/>
<xsl:for-each select="option"><option><xsl:copy-of select="@* | text()"/></option></xsl:for-each>
</select>
</xsl:template>

<!-- Avdiev
<xsl:template match="form//input[@type='submit']">
<input><xsl:copy-of select="@*"/></input>
</xsl:template>
-->

</xsl:stylesheet>


